<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>19.ISO与TIMESTAMP格式互换</title>
</head>
<body>
  <script>
    //时间转换成时间戳
    const date = new Date("1996-7-12 08:22:12");
    console.log(date * 1);
    console.log(Number(date));
    console.log(date.valueOf());
    console.log(date.getTime());

    //时间戳转日期
    const timestamp = date.valueOf();
    console.log(new Date(timestamp));

  </script>
</body>
</html>